/*************************************************************************
> File Name: stu.cpp
> Author: hzy
> Created Time: 2023-08-09 10:13:09
> Description:
************************************************************************/
#include "person.h"

void Person::init(int myid, string myname, int myage)
{
    id = myid;
    name = myname;

    if (myage < 0 || myage > 100)
    {
        cout << "输入年龄不符合范围!!!(0 < age < 100)" << endl;
        age = -1;
        return;
    }
    age = myage;
}

void Person::setId(int myid)
{
    id = myid;
}

void Person::setName(string myname)
{
    name = myname;
}

void Person::setAge(int myage)
{
    if (myage < 0 || myage > 100)
    {
        cout << "输入年龄不符合范围!!!(0 < age < 100)" << endl;
        age = -1;
        return;
    }
    age = myage;
}

int Person::getId()
{
    return age;
}

string Person::getName()
{
    return name;
}

int Person::getAge()
{
    return age;
}

void Person::show()
{
    cout << "id = " << id << ", name = " << name << ", age = " << age << endl;
}
